package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.FrameBytecodeEvent;

public class FrameBytecodeEventImpl extends BytecodeEventImpl implements FrameBytecodeEvent
{
    private int frameType;
    private int localVariables;
    private Object[] localVariableTypes;
    private int stackElements;
    private Object[] stackElementTypes;

    public FrameBytecodeEventImpl(final int aFrameType, final int aLocalVariables, final Object[] aLocalVariableTypes,
        final int aStackElements, final Object[] aStackElementTypes)
    {
        frameType = aFrameType;
        localVariables = aLocalVariables;
        localVariableTypes = aLocalVariableTypes;
        stackElements = aStackElements;
        stackElementTypes = aStackElementTypes;
    }

    @Override
    public int getType() {
        return FRAME;
    }

    @Override
    public void setFrameType(final int aFrameType) {
        frameType = aFrameType;
    }

    @Override
    public int getFrameType() {
        return frameType;
    }

    @Override
    public void setLocalVariables(final int aLocalVariables) {
        localVariables = aLocalVariables;
    }

    @Override
    public int getLocalVariables() {
        return localVariables;
    }

    @Override
    public void setLocalVariableTypes(final Object[] aLocalVariableTypes) {
        localVariableTypes = aLocalVariableTypes;
    }

    @Override
    public Object[] getLocalVariableTypes() {
        return localVariableTypes;
    }

    @Override
    public void setStackElements(final int aStackElements) {
        stackElements = aStackElements;
    }

    @Override
    public int getStackElements() {
        return stackElements;
    }

    @Override
    public void setStackElementTypes(final Object[] aStackElementTypes) {
        stackElementTypes = aStackElementTypes;
    }

    @Override
    public Object[] getStackElementTypes() {
        return stackElementTypes;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitFrame(this);
        return aBytecodeVisitor;
    }
}
